package com.example.opslog;

import com.example.opslog.aop.OpsLog;
import com.example.opslog.aop.OpsLogType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Administrator
 * @Description:
 * @Date: Created in 2019-06-03 11:11
 * @Modified By:
 */
@Slf4j
@RestController
public class HelloController {

  @Value("${name}")
  private String name;

  @RequestMapping("/")
  @OpsLog(value = "添加", type = OpsLogType.ADD)
  public String hello() {
    log.info("变量 name: {}", this.name);
    return "hello world";
  }

  @RequestMapping("/1")
  @OpsLog(value = "修改")
  public String hello1() {
    return "hello world";
  }

  @RequestMapping("/2")
  @OpsLog(value = "添加", type = {OpsLogType.ADD, OpsLogType.CHECK})
  public String hello2() {
    return "hello world";
  }
}
